package com.mall.controller;


import com.mall.common.utils.Response;
import com.mall.common.utils.ResponseMessage;
import com.mall.entity.Carousel;
import com.mall.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("product/carouse")
public class CarouselController {

    @Autowired
    private CarouselService carouselService;

    @GetMapping("/list")
    public Response getCarousel(){
        List<Carousel> carousels = carouselService.selectAllList();
        if (carousels!=null){
            return new Response(ResponseMessage.SUCCESS).data(carousels);
        }else {
            return new Response(ResponseMessage.ERROR);
        }
    }
}
